module Varstate :
  sig
    val get_offsets : int array -> int array
    val idx_to_varstate : int array -> int -> int array
    val varstate_to_idx : int array -> int array -> int
    val state_to_idx : int array -> int array -> int array -> int
    exception NoMoreStates
    val incstate : int array -> int array -> int list -> unit
    val map_state : int array -> int list -> (int array -> 'a) -> 'a list
    val iter_state : int array -> int list -> (int array -> 'a) -> unit
  end
module Factor :
  sig
    type variable = int
    type varvalue = int
    type condition = bool * variable * varvalue
    type feature =
      Factor.feature = {
      cond : condition array;
      weight_id : int;
      mutable weight : float;
    }
    type tree =
      Factor.tree =
        Leaf of float
      | Vertex of variable * varvalue * tree * tree
    type factor =
      Factor.factor =
        Feature of feature
      | FeatureSet of feature list
      | Table of int array * int array * float array
      | Tree of tree
      | Const of float
    exception CondFail
    val fmatch : int array -> (bool * int * int) array -> bool
    val fweight : varvalue array -> feature -> float
    val table_lookup : int array * int array * 'a array -> int array -> 'a
    val tree_lookup : varvalue array -> tree -> float
    val log_value : varvalue array -> factor -> float
    val e_fweight :
      float array array -> float array array -> feature -> float
    val e_table_value :
      int array * int array * float array -> float array array -> 'a -> float
    val e_tree_value :
      float array array -> float array array -> tree -> float
    val expected_log_value :
      factor -> float array array -> float array array -> float
    val raw_value : varvalue array -> factor -> float
    val num_tree_params : tree -> int
    val numparams : factor -> int
    val simplify_condl :
      int array ->
      (bool * int * int) list ->
      (bool * int * int) list -> (bool * int * int) array
    val simplify_feature : varvalue array -> feature -> feature
    val simplify_table :
      varvalue array -> int array -> int array -> float array -> factor
    val simplify_node : varvalue array -> tree -> tree
    val simplify_tree : varvalue array -> tree -> factor
    val simplify : varvalue array -> factor -> factor
    val tree_to_features : condition list -> tree -> feature list
    val table_to_features :
      variable array * int array * float array -> feature list
    val to_features : factor -> feature list
    val output_feature : out_channel -> feature -> unit
    val output_featurelist : out_channel -> feature list -> unit
    val output_tree : out_channel -> string -> tree -> unit
    val output_factor : out_channel -> factor -> unit
    val feature_set_vars : feature list -> variable list
    val tree_vars : tree -> variable list
    val vars : factor -> variable list
    val to_table : int array -> factor -> factor
    val copy_feature : feature -> feature
    val copy : factor -> factor
    val rescale_feature : float -> feature -> feature
    val rescale_tree : float -> tree -> tree
    val rescale : float -> factor -> factor
    module MP :
      sig
        type pcond = bool * int * int
        type pfeature = int * float * pcond list
        type pfeaturelist = pfeature list
        type ptree =
          MnParseTypes.ptree =
            PLeaf of float
          | PVertex of int * int * ptree * ptree
        type pfactor =
          MnParseTypes.pfactor =
            PFeatureSet of pfeaturelist
          | PFeatureTable of pfeaturelist
          | PFeatureTree of ptree
          | PFeature of pfeature
        type pmn =
          MnParseTypes.pmn = {
          factors : pfactor list;
          weights : (int * float) list;
        }
      end
    val pf_to_f : int * float * condition list -> feature
    val pfl_to_factor : (int * float * condition list) list -> factor
    val ptree_to_tree : MP.ptree -> tree
    val pfactor_to_factor : int array -> MP.pfactor -> factor
  end
type network = {
  schema : int array;
  factors : Factor.factor array;
  var_to_factors : Factor.factor list array;
}
val numvars : network -> int
val get_range : network -> int -> int
val num_values : network -> int -> int
val schema : network -> int array
val factors : network -> Factor.factor array
val build_var_to_factors :
  'a array -> Factor.factor array -> Factor.factor list array
val create : int array -> Factor.factor array -> network
val raw_logprob : network -> Factor.varvalue array -> float
val mb_logdist : network -> Factor.varvalue array -> int -> float array
val pll : network -> Factor.varvalue array -> float
val simplify : network -> Factor.varvalue array -> network
val to_features : network -> Factor.feature list
val input_features_lex : Lexing.lexbuf -> Factor.feature list
val input_features : in_channel -> Factor.feature list
module MP :
  sig
    type pcond = bool * int * int
    type pfeature = int * float * pcond list
    type pfeaturelist = pfeature list
    type ptree =
      MnParseTypes.ptree =
        PLeaf of float
      | PVertex of int * int * ptree * ptree
    type pfactor =
      MnParseTypes.pfactor =
        PFeatureSet of pfeaturelist
      | PFeatureTable of pfeaturelist
      | PFeatureTree of ptree
      | PFeature of pfeature
    type pmn =
      MnParseTypes.pmn = {
      factors : pfactor list;
      weights : (int * float) list;
    }
  end
val filename_is_mn : string -> bool
val filename_is_uai : string -> bool
val load : in_channel -> network
val load_uai : in_channel -> network
val output : out_channel -> network -> unit
val output_uai : out_channel -> int array -> Factor.factor array -> unit
val load_auto : string -> network
val write_auto : string -> network -> unit
